<!DOCTYPE html>
<!-- 网页使用的语言 -->
<html lang="zh-CN">
<head>
    <!-- 指定字符集 -->
    <meta charset="utf-8">
    <!-- 使用Edge最新的浏览器的渲染方式 -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- viewport视口：网页可以根据设置的宽度自动进行适配，在浏览器的内部虚拟一个容器，容器的宽度与设备的宽度相同。
    width: 默认宽度与设备的宽度相同
    initial-scale: 初始的缩放比，为1:1 -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>图书管理系统</title>

    <!-- 1. 导入CSS的全局样式 -->
    <link href="/static/css/bootstrap.min.css" rel="stylesheet">
    <!-- 2. jQuery导入，建议使用1.9以上的版本 -->
    <script src="/static/js/jquery-2.1.0.min.js"></script>
    <!-- 3. 导入bootstrap的js文件 -->
    <script src="/static/js/bootstrap.min.js"></script>
    <style type="text/css">
        td, th {
            text-align: center;
        }
    </style>
</head>


<body>
<div class="container">

    <ul class="nav nav-pills">
      <li role="presentation"><a href="/presslist/">出版社列表</a></li>
      <li role="presentation" ><a href="/booklist/">图书列表</a></li>
      <li role="presentation" class="active"><a href="/booktypelist/">图书类型</a></li>
    </ul>

    <h3 style="text-align: center">图书类型信息列表</h3>
    <form action="/booktypesearch/" method="post">
        <div class="form-group">
            <input style="width: 300px;display: inline" type="text" class="form-control" id="typename" name="typename" value="{{ typename }}"  placeholder="请输入图书类型名称" />
            <button type="submit" class="btn btn-warning glyphicon glyphicon-search">搜索</button>
        </div>
    </form>


    <table border="1" class="table table-bordered table-hover">
        <tr class="success">
            <th>编号</th>
            <th>图书类型名称</th>
            <th>图书详情</th>
            <th>操作</th>
        </tr>

        {% for booktype in booktypelist %}
            <tr>
                <td>{{ forloop.counter }}</td>
                <td>{{ booktype.typename }}</td>
                <td>

                    {% for book in booktype.books.all %}
                        《{{ book.bookname }}》
                    {% empty %}
                        <span style="color: red">暂无书籍</span>
                    {% endfor %}


                </td>
                <td>
                    <a class="btn btn-info btn-sm glyphicon glyphicon-pencil" href="/booktypeupdate?id={{ booktype.id }}">修改</a>&nbsp;
                    <a class="btn btn-danger btn-sm glyphicon glyphicon-trash" href="/booktypedelete?id={{ booktype.id }}" onclick="return confirm('您确定删除吗？')">删除</a>
                </td>
            </tr>
        {% endfor %}




        <tr>
            <td colspan="8" align="center"><a class="btn btn-primary glyphicon glyphicon-plus" href="/booktypeadd/">添加图书类型</a></td>
        </tr>
    </table>

<!-- Button trigger modal -->
{% comment %}<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
  Launch demo modal
</button>{% endcomment %}

<!-- Modal -->
{% comment %}<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">Modal title</h4>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>{% endcomment %}

</div>
</body>
</html>
